package cn.samler.shopapi.Service;

import cn.samler.shopapi.Entity.Cart;
import cn.samler.shopapi.Entity.User;
import cn.samler.shopapi.Model.Request.Cart.Goods;
import cn.samler.shopapi.Model.Request.Cart.CartModel;
import cn.samler.shopapi.Model.Sys.ServiceResult;
import com.alibaba.fastjson.JSONArray;
import org.springframework.transaction.annotation.Transactional;

@Transactional
public interface CartService {
    Cart find(int uid, Goods goods);

    Cart findByToken(int uid, int gid, String token);

    JSONArray findAll(int uid);

    ServiceResult add(int uid, Goods goods);

    ServiceResult updateNumber(User user, CartModel updateNumber);

    boolean remove(int uid, Goods goods);

    boolean removeByToken(int uid, int gid, String token);

    boolean update(int uid, Goods goods);

    boolean checkSpec(int gid, int sid, int itemId);
}
